package club.xyes.zkh.ecommerce.commons.entity;

import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.persistence.Column;
import javax.persistence.Table;

/**
 * Create by 郭文梁 2019/4/19 0019 17:57
 * TransactionLog
 * 交易记录实体类
 *
 * @author 郭文梁
 * @data 2019/4/19 0019
 */
@EqualsAndHashCode(callSuper = true)
@Data
@Table(name = "t_transaction_log")
public class TransactionLog extends BaseEntity {
    /**
     * 状态：创建
     */
    public static final int STATUS_CREATE = 0x01;
    /**
     * 状态：待付款
     */
    public static final int STATUS_PENDING_PAYMENT = 0x02;
    /**
     * 状态：订单关闭
     */
    public static final int STATUS_CLOSED = 0x03;
    /**
     * 状态：已付款
     */
    public static final int STATUS_PAID = 0x04;
    /**
     * 状态：已退款
     */
    public static final int STATUS_REFUNDED = 0x05;
    /**
     * 用户ID
     */
    @Column(name = "user_id", length = 10, nullable = false)
    private Integer userId;
    /**
     * 关联的用户对象
     */
    private User user;
    /**
     * 商铺ID
     */
    @Column(name = "shop_id", length = 10, nullable = false)
    private Integer shopId;
    /**
     * 关联的商铺对象
     */
    private Shop shop;
    /**
     * 应付金额 单位：分
     */
    @Column(name = "amount_payable", length = 10, nullable = false)
    private Integer amountPayable;
    /**
     * 优惠券优惠金额
     */
    @Column(name = "coupon_discount_amount", length = 10)
    private Integer couponDiscountAmount;
    /**
     * 会员优惠金额
     */
    @Column(name = "membership_discount_amount", length = 10)
    private Integer membershipDiscountAmount;
    /**
     * 实付金额
     */
    @Column(name = "actual_amount_paid", length = 10, nullable = false)
    private Integer actualAmountPaid;
    /**
     * 未参与优惠金额
     */
    @Column(name = "no_discount_amount")
    private Integer noDiscountAmount;
    /**
     * 使用的用户优惠券ID
     */
    @Column(name = "user_coupon_id", length = 10)
    private Integer userCouponId;
    /**
     * 关联的UserCoupon对象
     */
    private UserCoupon userCoupon;
    /**
     * 付款时会员等级定义ID
     */
    @Column(name = "membership_level_id", length = 10)
    private Integer membershipLevelId;
    /**
     * 关联的ShopMembershipLevel;对象
     */
    private ShopMembershipLevel level;
    /**
     * 系统订单号
     */
    @Column(name = "trade_no", nullable = false)
    private String tradeNo;
    /**
     * 退款记录号
     */
    @Column(name = "refund_trace_no")
    private String refundTraceNo;
    /**
     * 扫呗订单ID
     */
    @Column(name = "out_trade_no", nullable = false)
    private String outTradeNo;
    /**
     * 创建订单是扫呗返回的源数据
     */
    @Column(name = "create_json")
    private String createJson;
    /**
     * 系统查询交易状态时 扫呗返回的订单状态源数据
     */
    @Column(name = "query_json")
    private String queryJson;
    /**
     * 扫呗通知原始数据
     */
    @Column(name = "notify_json")
    private String notifyJson;
    /**
     * 订单状态
     */
    @Column(name = "status", length = 2, nullable = false)
    private Integer status;
}
